Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program
Optional host: CompilerHostOptional oldProgram: TOptional configFileParsingDiagnostics: readonly Diagnostic[]Optional projectReferences: readonly ProjectReference[]Deprecated, please use UpdateExpression
Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute.
Branded string for keeping track of when we've turned an ambiguous path specified like "./blah" to an absolute path to an actual tsconfig file, e.g. "/root/blah/tsconfig.json"
SymbolTable based on ES6 Map interface.
A function that transforms a node.
A function that is used to initialize and return a Transformer callback, which in turn
will be used to transform one or more nodes.
A function that accepts and possibly transforms a node.
Optional errorCount: numberOptional onError: (message: string) => voidOptional sourceFiles: readonly TypeScript.SourceFile[]This represents a string whose leading underscore have been escaped by adding extra leading underscores. The shape of this brand is rather unique compared to others we've used. Instead of just an intersection of a string and an object, it is that union-ed with an intersection of void and an object. This makes it wholly incompatible with a normal string (which is good, it cannot be misused on assignment or on usage), while still being comparable with a normal string via === (also good) and castable from a string.
The version of the language service API
The version of the TypeScript compiler release
Adds an EmitHelper to a node.
Add EmitHelpers to a node.
Optional hasTrailingNewLine: booleanOptional hasTrailingNewLine: booleanOptional cache: NonRelativeModuleNameResolutionCacheOptional redirectedReference: ResolvedProjectReferenceCalled to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn.
This function will then merge those changes into a single change range valid between V1 and Vn.
Optional configFileName: stringConvert the json syntax tree into the json value
Optional configFileName: stringCreates a builder thats just abstraction over program and can be used with watch
Optional oldProgram: BuilderProgramOptional configFileParsingDiagnostics: readonly Diagnostic[]Optional host: CompilerHostOptional oldProgram: BuilderProgramOptional configFileParsingDiagnostics: readonly Diagnostic[]Optional projectReferences: readonly ProjectReference[]Const createConst createConst createOptional elements: readonly Expression[]Optional multiLine: booleanConst createConst createConst createConst createConst createConst createConst createConst createOptional initializer: ExpressionConst createConst createOptional label: string | IdentifierCreate a function that reports watch status by writing to the system and handles the formating of the diagnostic
Optional pretty: booleanConst createOptional prepends: readonly (InputFiles | UnparsedSource)[]Const createConst createConst createConst createConst createConst createConst createConst createThe classifier is used for syntactic highlighting in editors via the TSServer
Const createConst createOptional setParentNodes: booleanConst createConst createConst createConst createConst createConst createConst createOptional label: string | IdentifierConst createConst createConst createConst createConst createOptional useCaseSensitiveFileNames: booleanOptional currentDirectory: stringConst createConst createCreate the builder that can handle the changes in program and iterate through changed files to emit the those files and manage semantic diagnostics cache as well
Optional oldProgram: EmitAndSemanticDiagnosticsBuilderProgramOptional configFileParsingDiagnostics: readonly Diagnostic[]Optional host: CompilerHostOptional oldProgram: EmitAndSemanticDiagnosticsBuilderProgramOptional configFileParsingDiagnostics: readonly Diagnostic[]Optional projectReferences: readonly ProjectReference[]Const createConst createConst createOptional initializer: ExpressionConst createConst createOptional moduleSpecifier: ExpressionOptional isTypeOnly: anyConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createOptional elseStatement: StatementConst createConst createConst createOptional isTypeOnly: anyConst createOptional assertClause: AssertClauseConst createConst createConst createOptional qualifier: EntityNameOptional typeArguments: readonly TypeNode[]Optional isTypeOf: booleanOptional system: SystemConst createConst createConst createConst createConst createConst createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional fullName: Identifier | JSDocNamespaceDeclarationOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Optional tags: readonly JSDocTag[]Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional typeExpression: JSDocTypeExpressionOptional comment: stringConst createJSDocOptional typeExpression: JSDocTypeExpressionOptional isNameFirst: booleanOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional typeExpression: JSDocTypeExpressionOptional isNameFirst: booleanOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional typeExpression: JSDocTypeExpressionOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional type: JSDocReturnTagConst createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocConst createJSDocOptional jsDocPropertyTags: readonly JSDocPropertyLikeTag[]Optional isArrayType: booleanConst createJSDocOptional comment: string | NodeArray<JSDocComment>Const createJSDocOptional typeExpression: JSDocTypeExpression | JSDocTypeLiteralOptional fullName: Identifier | JSDocNamespaceDeclarationOptional comment: string | NodeArray<JSDocComment>Const createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createOptional containsOnlyTriviaWhiteSpaces: booleanConst createConst createOptional documentRegistry: DocumentRegistryOptional syntaxOnlyOrLanguageServiceMode: boolean | LanguageServiceModeOptional scriptKind: ScriptKindConst createConst createConst createConst createConst createConst createConst createOptional reservedInNestedScopes: booleanConst createConst createConst createConst createConst createConst createConst createConst createOptional flags: NodeFlagsOptional options: CompilerOptionsConst createConst createConst createConst createConst createConst createConst createOptional rawText: stringConst createOptional pos: anyOptional end: anyConst createConst createConst createConst createConst createConst createOptional numericLiteralFlags: TokenFlagsConst createConst createOptional properties: readonly ObjectLiteralElementLike[]Optional multiLine: booleanConst createConst createConst createConst createOptional questionToken: QuestionTokenOptional type: TypeNodeOptional initializer: ExpressionConst createConst createConst createOptional original: NodeConst createConst createConst createOptional printerOptions: PrinterOptionsOptional handlers: PrintHandlersConst createCreate a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' that represent a compilation unit.
Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
The options for creating a program.
A 'Program' object.
Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' that represent a compilation unit.
Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in.
A set of root files.
The compiler options which should be used.
Optional host: CompilerHostThe host interacts with the underlying file system.
Optional oldProgram: ProgramReuses an old program structure.
Optional configFileParsingDiagnostics: readonly Diagnostic[]error during config file parsing
A 'Program' object.
Const createConst createConst createConst createConst createOptional initializer: ExpressionConst createConst createConst createConst createOptional expression: ExpressionOptional languageVariant: LanguageVariantOptional textInitial: stringOptional onError: ErrorCallbackOptional start: numberOptional length: numberCreate the builder to manage semantic diagnostics and cache them
Optional oldProgram: SemanticDiagnosticsBuilderProgramOptional configFileParsingDiagnostics: readonly Diagnostic[]Optional host: CompilerHostOptional oldProgram: SemanticDiagnosticsBuilderProgramOptional configFileParsingDiagnostics: readonly Diagnostic[]Optional projectReferences: readonly ProjectReference[]Const createConst createConst createOptional objectAssignmentInitializer: ExpressionOptional system: SystemOptional createProgram: CreateProgram<T>Optional reportDiagnostic: DiagnosticReporterOptional reportSolutionBuilderStatus: DiagnosticReporterOptional reportErrorSummary: ReportEmitErrorSummaryOptional baseWatchOptions: WatchOptionsOptional system: SystemOptional createProgram: CreateProgram<T>Optional reportDiagnostic: DiagnosticReporterOptional reportSolutionBuilderStatus: DiagnosticReporterOptional reportWatchStatus: WatchStatusReporterOptional setParentNodes: booleanOptional scriptKind: ScriptKindCreate an external source map source file reference
Optional skipTrivia: (pos: number) => numberConst createConst createConst createConst createConst createConst createOptional isSingleQuote: booleanOptional isSingleQuote: booleanOptional hasExtendedUnicodeEscape: booleanConst createOptional isSingleQuote: booleanConst createConst createConst createConst createConst createConst createConst createOptional rawText: stringOptional templateFlags: TokenFlagsOptional templateFlags: TokenFlagsConst createOptional rawText: stringOptional templateFlags: TokenFlagsOptional templateFlags: TokenFlagsConst createConst createOptional rawText: stringOptional templateFlags: TokenFlagsOptional templateFlags: TokenFlagsConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createConst createOptional constraint: TypeNodeOptional defaultType: TypeNodeConst createConst createConst createOptional options: CompilerOptionsOptional packageJsonInfoCache: PackageJsonInfoCacheConst createOptional typeArguments: readonly TypeNode[]Const createConst createOptional flags: GeneratedIdentifierFlagsOptional stripInternal: booleanConst createOptional type: TypeNodeOptional initializer: ExpressionConst createOptional flags: NodeFlagsConst createConst createConst createCreate the watch compiler host for either configFile or fileNames and its options
Optional createProgram: CreateProgram<T>Optional reportDiagnostic: DiagnosticReporterOptional reportWatchStatus: WatchStatusReporterOptional watchOptionsToExtend: WatchOptionsOptional extraFileExtensions: readonly FileExtensionInfo[]Optional createProgram: CreateProgram<T>Optional reportDiagnostic: DiagnosticReporterOptional reportWatchStatus: WatchStatusReporterOptional projectReferences: readonly ProjectReference[]Optional watchOptions: WatchOptionsCreates the watch from the host for root files and compiler options
Creates the watch from the host for config file
Const createConst createConst createOptional expression: ExpressionClears any EmitNode entries from parse-tree nodes.
A source file.
Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like 'proto'
Iterates through the parent chain of a node and performs the callback on each parent until the callback returns a truthy value, then returns that value. If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" At that point findAncestor returns undefined.
Optional configName: stringOptional indent: numberInvokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned.
Gets all JSDoc tags of a specified kind
Given a set of options, returns the set of type directive names that should be included for this program automatically. This list could either come from the config file, or from enumerating the types root + initial secondary types lookup location. More type directives might appear in the program later as a result of loading actual source files; this list is only the set of defaults that are implicitly included.
Gets the constant value to emit for an expression representing an enum.
Optional newLineCharacter: stringGet the path of the default library files (lib.d.ts) as distributed with the typescript node package. The functionality is not supported if the ts module is consumed outside of a node module.
Gets the effective type parameters. If the node was parsed in a
JavaScript file, gets the type parameters from the @template tag from JSDoc.
Gets the EmitHelpers of a node.
Const getA function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
options parameter.
The normalized absolute path to check the format of (it need not exist on disk)
The ModuleResolutionHost which can perform the filesystem lookups for package json data
The compiler options to perform the analysis under - relevant options are moduleResolution and traceResolution
undefined if the path has no relevant implied format, ModuleKind.ESNext for esm format, and ModuleKind.CommonJS for cjs format
Gets the JSDoc augments tag for the node if present
Gets the JSDoc class tag for the node if present
Gets the JSDoc deprecated tag for the node if present
Gets the JSDoc enum tag for the node if present
Gets the JSDoc implements tags for the node if present
Gets the JSDoc parameter tags for the node if present.
Gets the JSDoc private tag for the node if present
Gets the JSDoc protected tag for the node if present
Gets the JSDoc public tag for the node if present
Gets the JSDoc protected tag for the node if present
Gets the JSDoc return tag for the node if present
Gets the JSDoc template tag for the node if present
Gets the JSDoc this tag for the node if present
Gets the JSDoc type parameter tags for the node if present.
Gets the JSDoc type tag for the node if present and valid
Const getCreates a shallow, memberwise clone of a node for mutation with its pos, end, and parent set.
NOTE: It is unsafe to change any properties of a Node that relate to its AST children, as those changes won't be
captured with respect to transformations.
Gets the original parse tree node for a node.
The original node.
The original parse tree node if found; otherwise, undefined.
Gets the original parse tree node for a node.
The original parse tree node if found; otherwise, undefined.
Reads the config file, reports errors if any and exits if the config file cannot be found
Optional extendedConfigCache: Map<ExtendedConfigCacheEntry>Optional watchOptionsToExtend: WatchOptionsOptional extraFileExtensions: readonly FileExtensionInfo[]Optional sourceFile: TypeScript.SourceFileOptional cancellationToken: CancellationTokenOptionally, get the shebang
Gets a custom text range to use when emitting source maps.
Gets the text of a jsdoc comment, flattening links to their text.
Optional comment: string | NodeArray<JSDocComment>Gets the TextRange to use for source maps for a token of a node.
Return true if the node has JSDoc parameter tags.
True if has initializer node attached to it.
Const isOptional identifierVariant: LanguageVariantTrue if node is of a kind that may contain comment text.
Gets a value indicating whether a node originated in the parse tree.
The node to test.
True if node is of some token syntax kind. For example, this is true for an IfKeyword but not for an IfStatement. Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
True if kind is of some token syntax kind. For example, this is true for an IfKeyword but not for an IfStatement. Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
Const isDoes not include line breaks. For that, see isWhiteSpaceLike.
Moves matching emit helpers from a source node to a target node.
Optional cache: ModuleResolutionCacheOptional redirectedReference: ResolvedProjectReferenceOptional readFile: (path: string) => undefined | stringParse the text of the tsconfig.json file
The path to the config file
The text of the config file
Optional config?: anyOptional error?: DiagnosticParse the contents of a config file (tsconfig.json).
The contents of the config file to parse
Instance of ParseConfigHost used to enumerate files in folder.
A root directory to resolve relative path entries in the config file to. e.g. outDir
Optional existingOptions: CompilerOptionsOptional configFileName: stringOptional resolutionStack: Path[]Optional extraFileExtensions: readonly FileExtensionInfo[]Optional extendedConfigCache: Map<ExtendedConfigCacheEntry>Optional existingWatchOptions: WatchOptionsParse the contents of a config file (tsconfig.json).
Instance of ParseConfigHost used to enumerate files in folder.
A root directory to resolve relative path entries in the config file to. e.g. outDir
Optional existingOptions: CompilerOptionsOptional configFileName: stringOptional resolutionStack: Path[]Optional extraFileExtensions: readonly FileExtensionInfo[]Optional extendedConfigCache: Map<ExtendedConfigCacheEntry>Optional existingWatchOptions: WatchOptionsParse json text into SyntaxTree and return node and parse errors if any
Optional readImportFiles: booleanOptional detectJavaScriptImports: booleanRead tsconfig.json file
The path to the config file
Optional config?: anyOptional error?: DiagnosticRead tsconfig.json file
The path to the config file
Removes an EmitHelper from a node.
Optional cache: ModuleResolutionCacheOptional redirectedReference: ResolvedProjectReferenceOptional resolutionMode: CommonJS | ESNextOptional mode: CommonJS | ESNextReturns the target config filename of a project reference. Note: The file might not exist.
file that contains type reference directive, can be undefined if containing file is unknown. This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups is assumed to be the same as root directory of the project.
Optional redirectedReference: ResolvedProjectReferenceOptional cache: TypeReferenceDirectiveResolutionCacheSets the constant value to emit for an expression.
Sets a custom text range to use when emitting source maps.
Sets the TextRange to use for source maps for a token of a node.
Transform one or more nodes using the supplied transformers.
A single Node or an array of Node objects.
An array of TransformerFactory callbacks used to process the transformation.
Optional compilerOptions: CompilerOptionsOptional compiler options.
Optional compilerOptions: CompilerOptionsOptional fileName: stringOptional diagnostics: Diagnostic[]Optional moduleName: stringRemove extra underscore from escaped identifier text content.
The escaped identifier text.
The unescaped identifier text.
Const updateConst updateConst updateConst updateConst updateConst updateConst updateOptional operator: BinaryOperator | BinaryOperatorTokenConst updateConst updateConst updateConst updateOptional prepends: readonly (InputFiles | UnparsedSource)[]Const updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateOptional isTypeOf: booleanConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateOptional aggressiveChecks: booleanConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateOptional aggressiveChecks: booleanConst updateOptional isDeclarationFile: booleanOptional referencedFiles: readonly FileReference[]Optional typeReferences: readonly FileReference[]Optional hasNoDefaultLib: booleanOptional libReferences: readonly FileReference[]Const updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateConst updateChecks to see if the locale is in the appropriate format, and if it is, attempts to set the appropriate language.
Optional errors: Push<Diagnostic>Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
The Node whose children will be visited.
The callback used to visit each child.
A lexical environment context for the visitor.
Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
The Node whose children will be visited.
The callback used to visit each child.
A lexical environment context for the visitor.
Optional nodesVisitor: { <T>(nodes: NodeArray<T>, visitor: undefined | Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>; <T>(nodes: undefined | NodeArray<T>, visitor: undefined | Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined }Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
The NodeArray to visit.
The callback used to visit a Node.
Optional test: (node: Node) => booleanA node test to execute for each node.
Optional start: numberAn optional value indicating the starting offset at which to start visiting.
Optional count: numberAn optional value indicating the maximum number of nodes to visit.
Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
The NodeArray to visit.
The callback used to visit a Node.
Optional test: (node: Node) => booleanA node test to execute for each node.
Optional start: numberAn optional value indicating the starting offset at which to start visiting.
Optional count: numberAn optional value indicating the maximum number of nodes to visit.
Optional tokenVisitor: VisitorResumes a suspended lexical environment and visits a function body, ending the lexical environment and merging hoisted declarations upon completion.
Resumes a suspended lexical environment and visits a function body, ending the lexical environment and merging hoisted declarations upon completion.
Resumes a suspended lexical environment and visits a concise body, ending the lexical environment and merging hoisted declarations upon completion.
Visits an iteration body, adding any block-scoped variables required by the transformation.
Starts a new lexical environment and visits a statement list, ending the lexical environment and merging hoisted declarations upon completion.
Optional start: numberOptional ensureUseStrict: booleanOptional nodesVisitor: NodesVisitorVisits a Node using the supplied visitor, possibly returning a new Node in its place.
Visits a Node using the supplied visitor, possibly returning a new Node in its place.
The Node to visit.
The callback used to visit the Node.
Optional test: (node: Node) => booleanA callback to execute to verify the Node is valid.
Optional lift: (node: readonly Node[]) => TAn optional callback to execute to lift a NodeArray into a valid Node.
Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
The NodeArray to visit.
The callback used to visit a Node.
Optional test: (node: Node) => booleanA node test to execute for each node.
Optional start: numberAn optional value indicating the starting offset at which to start visiting.
Optional count: numberAn optional value indicating the maximum number of nodes to visit.
Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
The NodeArray to visit.
The callback used to visit a Node.
Optional test: (node: Node) => booleanA node test to execute for each node.
Optional start: numberAn optional value indicating the starting offset at which to start visiting.
Optional count: numberAn optional value indicating the maximum number of nodes to visit.
Starts a new lexical environment and visits a parameter list, suspending the lexical environment upon completion.
Optional nodesVisitor: NodesVisitorOptional nodesVisitor: NodesVisitorGenerated using TypeDoc
deprecatedUse
AssertsKeywordinstead.